<?php $this->headScript()->appendFile($this->JS_PATH . 'request.js'); ?>
<?php $this->headScript()->appendFile($this->JS_PATH . 'bootstrap.datepicker.js'); ?>

<div id="request-listing"></div>
<?php echo $this->flashmessages(); ?>
<?php if (count($this->errorMessage) > 0): ?>
    <div class="alert alert-error">
        <?php foreach ($this->errorMessage as $erroValue): ?>
            <div class="text-left">
                <i class="icon-remove-sign"></i>
                <?php echo $erroValue; ?>
            </div>
        <?php endforeach; ?>
    </div>
<?php endif; ?>
<div id="pad-wrapper">
     <div class="row pagelist-header">
        <h3><?php echo $this->translate("req_list_main_title"); ?></h3>
    </div>
    <div class="table-products">

        <form action="" method="post" id="requestlistingfrm">
           
            <div class="row-fluid ">
                <div class="pull-right">
                    <input type="text" class="search" name="searchtype" value="<?php echo $this->searchtype ?>" >
                    <input type="submit" value="<?php echo $this->translate("search_field"); ?>" name="searchbutton"  id="searchbutton" class="btn-flat new-product"/>      
                    <a class="btn-flat new-product" href="<?php echo $this->url(array('module' => 'default', 'controller' => 'request', 'action' => 'form'), null, TRUE); ?>">+ <?php echo $this->translate("req_list_add_title"); ?></a>
                </div>
            </div>

            <div class="row">
                <?php if (count($this->requestsData) > 0): ?> 
                    <div class="delete_All">    
                        <input type="submit" accesskey="s" value="<?php echo $this->translate("delete_all"); ?>" name="multiaction"  id="multiaction" class="btn-flat danger"/>      
                        <?php else: ?>
                        &nbsp;
                <?php endif; ?>
                </div>
                <table class="table table-hover">
                    <thead>
                        <tr>
                            <th class="col-md-3 ">
                                <input id="selectall" type="checkbox" />
                                <a href="<?php echo $this->url(array('controller' => 'request', 'action' => 'list', 'field' => 'com_name', 'sort' => 'asc'), 'default', false); ?>">
                                    <img src="<?php echo $this->IMAGE_PATH; ?>datatables/sort_asc.png"  alt="Ascending" title="Ascending" class="sort_asc" />
                                </a>
                                <?php echo $this->translate("req_frm_company"); ?>
                                <a href="<?php echo $this->url(array('controller' => 'request', 'action' => 'list', 'field' => 'com_name', 'sort' => 'desc'), 'default', false); ?>">
                                    <img src="<?php echo $this->IMAGE_PATH; ?>datatables/sort_desc.png"  alt="Descending" title="Descending" class="sort_desc"  />
                                </a>
                            </th>
                            
                            <th class="col-md-3">
                                <span class="line"></span>
                                <a href="<?php echo $this->url(array('controller' => 'request', 'action' => 'list', 'field' => 'subj_name', 'sort' => 'asc'), 'default', false); ?>">
                                    <img src="<?php echo $this->IMAGE_PATH; ?>datatables/sort_asc.png"  alt="Ascending" title="Ascending" class="sort_asc" />
                                </a>
                                <?php echo $this->translate("req_list_subject"); ?>
                                <a href="<?php echo $this->url(array('controller' => 'request', 'action' => 'list', 'field' => 'subj_name', 'sort' => 'desc'), 'default', false); ?>">
                                    <img src="<?php echo $this->IMAGE_PATH; ?>datatables/sort_desc.png"  alt="Descending" title="Descending" class="sort_desc"  />
                                </a>
                            </th>

                            <th class="col-md-3 ">
                                <span class="line"></span>
                                <a href="<?php echo $this->url(array('controller' => 'request', 'action' => 'list', 'field' => 'site_name', 'sort' => 'asc'), 'default', false); ?>">
                                    <img src="<?php echo $this->IMAGE_PATH; ?>datatables/sort_asc.png"  alt="Ascending" title="Ascending" class="sort_asc" />
                                </a>
                                <?php echo $this->translate("req_list_site"); ?>
                                <a href="<?php echo $this->url(array('controller' => 'request', 'action' => 'list', 'field' => 'site_name', 'sort' => 'desc'), 'default', false); ?>">
                                    <img src="<?php echo $this->IMAGE_PATH; ?>datatables/sort_desc.png"  alt="Descending" title="Descending" class="sort_desc"  />
                                </a>
                            </th>

                            
                            <th class="col-md-3">
                                <span class="line"></span>
                                <a href="<?php echo $this->url(array('controller' => 'request', 'action' => 'list', 'field' => 'req_status', 'sort' => 'asc'), 'default', false); ?>">
                                    <img src="<?php echo $this->IMAGE_PATH; ?>datatables/sort_asc.png"  alt="Ascending" title="Ascending" class="sort_asc" />
                                </a>
                                <?php echo $this->translate("req_list_status"); ?>
                                <a href="<?php echo $this->url(array('controller' => 'request', 'action' => 'list', 'field' => 'req_status', 'sort' => 'desc'), 'default', false); ?>">
                                    <img src="<?php echo $this->IMAGE_PATH; ?>datatables/sort_desc.png"  alt="Descending" title="Descending" class="sort_desc"  />
                                </a>
                                <span class="cls_action"> <?php echo $this->translate("list_action"); ?></span>
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php if (count($this->requestsData) > 0): ?>
                            <?php $counter = 0; ?>
                            <?php foreach ($this->requestsData as $key => $value) : ?>
                                <tr <?php if ($counter == 0): ?>class="first"<?php endif; ?>>
                                    <td>
                                        <input type="checkbox" class="content-checkbox" name="multicheck[]" value="<?php echo $value["req_id"]; ?>"/>
                                        <a href="<?php echo $this->url(array('controller' => 'request', 'action' => 'form', 'req_id' => $value["req_id"]), null, true); ?>">
                                            <?php echo ucfirst($value['com_name']) ?></a>
                                    </td>
                                   
                                    <td class="">
                                        <?php echo ucfirst($value['subj_name']); ?>
                                    </td>
                                    
                                    <td class="">
                                        <?php echo $value['site_name']; ?>
                                    </td>

                                    
                                    <td>
                                        
                                            <span class="label label-success"><?php echo $value['req_status_name']; ?></span>
                                            
                                           
                                        <ul class="actions">
                                            <li>
                                                <a title="Edit" href="<?php echo $this->url(array('controller' => 'request', 'action' => 'form', 'req_id' => $value["req_id"]), null, true); ?>">
                                                    <i class="table-edit"></i>
                                                </a>
                                            </li>
                                            <li>
                                                <a title="View" class="view_anchr" href="<?php echo $this->url(array('controller' => 'request', 'action' => 'view', 'req_id' => $value["req_id"]), null, true); ?>">
                                                    <i class="icon-eye-open"></i>
                                                </a>
                                            </li>
                                            <li class="last">
                                                <a title="Delete" href="<?php echo $this->url(array('controller' => 'request', 'action' => 'delete', 'req_id' => $value["req_id"]), null, true); ?>">
                                                    <i class="table-delete"></i>
                                                </a>
                                            </li>
                                        </ul>
                                    </td>
                                </tr>
                                <?php $counter++; ?>
                            <?php endforeach; ?>
                        <?php else: ?>
                            <tr class="row2" >
                                <td>&nbsp;</td>
                                <td colspan="8"><?php echo $this->translate("no_record"); ?></td>
                            </tr>
                        <?php endif; ?>
                    </tbody>
                </table>
            </div>
            <?php
            if (count($this->requestsData) > 0):
                echo $this->paginator->displayPages();
            endif;
            ?>

        </form>
    </div>
</div>